package com.asiainfo.dacp.datastash.console.application.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.context.request.WebRequest;

/**
 * 编排与开发
 * @author MeiKefu
 * @date 2017-11-15
 */
@Controller
@RequestMapping("/datastash/workshop")
public class StashWorkshopController {

    @RequestMapping("")
    public String workshop(){
        return "datastash/workshop/unit_list/unit_list";
    }

    @RequestMapping("unit/creator")
    public String creator(){
        return "datastash/workshop/unit_creator/unit_creator";
    }

    @RequestMapping("unit/publish")
    public String permit(){
        return "datastash/workshop/unit_list/unit_permit";
    }

    @RequestMapping(value = "unit/{id}", method = RequestMethod.GET)
    public String unitCreator(WebRequest request, Model model, @PathVariable String id) {
        model.addAttribute("dataId", id);
        return "datastash/workshop/unit_creator/unit_creator";
    }

    /*@RequestMapping("unit/state")
    public String unitState(){
        return "datastash/workshop/unit_state/unit_state_list";
    }*/
    
    @RequestMapping("unit/state")
    public String unitState(){
        return "datastash/workshop/unit_state/unit_state_log";
    }
    
    @RequestMapping("unit/task/state/{id}")
    public String taskState(WebRequest request, Model model, @PathVariable String id) {
        model.addAttribute("unitProcId", id);
        return "datastash/workshop/unit_state/unit_task_state_log";
    }
    
    @RequestMapping("unit/log")
    public String unitLog(){
        return "datastash/workshop/unit_state/unit_event_list";
    }

    @RequestMapping(value = "unit/log/{id}", method = RequestMethod.GET)
    public String unitLog(WebRequest request, Model model, @PathVariable String id) {
        model.addAttribute("unitProcId", id);
        return "datastash/workshop/unit_state/unit_event_list";
    }

    @RequestMapping("unit/task/log")
    public String unitTaskLog(){
        return "datastash/workshop/unit_state/unit_task_event_list";
    }

    @RequestMapping(value = "unit/task/log/{id}", method = RequestMethod.GET)
    public String unitTaskLog(WebRequest request, Model model, @PathVariable String id) {
        model.addAttribute("taskProcId", id);
        return "datastash/workshop/unit_state/unit_task_event_list";
    }

    @RequestMapping("unit/stepdefine")
    public String unitStepDefine(){
        return "datastash/workshop/step_define/step_define";
    }
    
    @RequestMapping("unit/monitor")
    public String unitMonitor(){
    	return "datastash/workshop/unit_monitor/unit_monitor_list";
    }

}
